package com.tzl.util;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Map;

public class JwtUtil {
	private static final String SECRET = "HZIT";
	public static String createToken(Map<String, Object> claims)
	{
		String token = Jwts.builder().setClaims(claims)
				.signWith(SignatureAlgorithm.HS512, SECRET).compact();
		return token;
	}
	public static Claims parseToken(String token)
	{
		return Jwts.parser().setSigningKey(SECRET).parseClaimsJws(token).getBody();
	}
}
